<? if(!defined('IN_DISCUZ')) exit('Access Denied'); hookscriptoutput('portalcp_block');?><? include template('common/header'); ?><?php $height = !empty($blocktype) ? '260px' : '380px'; if($op == 'block') { ?>
<h3 class="flb">
<em id="return_<?=$_G['gp_handlekey']?>">编辑模块</em>
<span>
<? if($_G['inajax']) { ?><a href="javascript:;" class="flbc" onclick="hideWindow('<?=$_G['gp_handlekey']?>');<? if(empty($bid)) { ?>drag.removeBlock('<?=$_GET['eleid']?>',true);<? } ?>return false;" title="关闭">关闭</a><? } ?>
</span>
</h3>
<? if($bid) { ?>
<div class="y">
</div>
<? } ?>
<ul class="tb cl">
<? if($blocksettingperm) { ?><li id="li_setting"<? if($tab=="setting") { ?> class="a"<? } ?>><a href="javascript:;" onclick="switch_blocktab('setting');this.blur();return false;">模块属性</a></li><? } if($bid && !$is_htmlblock) { if($blockdataperm) { ?><li id="li_data"<? if($tab=="data") { ?> class="a"<? } ?>><a href="javascript:;" onclick="switch_blocktab('data');this.blur();return false;">模块数据</a></li><? } } ?>
</ul>

<? if($blocksettingperm) { ?>
<form id="blockformsetting" name="blockformsetting" method="post" autocomplete="off" action="portal.php?mod=portalcp&amp;ac=block&amp;op=block&amp;classname=<?=$_GET['classname']?>&amp;bid=<?=$block['bid']?>&amp;blocktype=<?=$blocktype?>&amp;eleid=<?=$_GET['eleid']?>&amp;tpl=<?=$_GET['tpl']?>"<? if($tab=="data") { ?> style="display: none;"<? } ?> onsubmit="ajaxpost('blockformsetting','return_<?=$_G['gp_handlekey']?>','return_<?=$_G['gp_handlekey']?>','onerror');" class="fdiy">
<div class="c" style="width: 420px; max-height:<?=$height?>; height:auto !important; height:320px; _padding-right: 0; _margin-right: 17px; overflow-y: auto;">
<div id="block_setting">
<table class="tfm">
<? if($showhtmltip) { ?>
<tr>
<td colspan="2" style="color: red">
此模块数据由属性决定，请编辑属性以展示需要的数据</td>
</tr>
<? } if(!$is_htmlblock) { ?>
<tr>
<th>自定义内容 <br /></th>
<td><a href="javascript:;" onclick="$('block_sumamry_<?=$block['bid']?>').style.display='block';this.style.display='none';return false;">编辑</a>
<textarea name="summary" id="block_sumamry_<?=$block['bid']?>" cols="40" rows="3" class="pt" style="display:none"><?=$block['summary']?></textarea></td>
</tr>
<? } ?>
<tr>
<th>数据来源</th>
<td>
<select name="script" onchange="block_get_setting('<?=$_GET['classname']?>', this.value);" class="ps"><? if(is_array($theclass['script'])) foreach($theclass['script'] as $bkey => $bname) { ?><option value="<?=$bkey?>"<?=$scriptarr[$bkey]?>><?=$bname?></option>
<? } ?>
</select>
</td>
</tr>
<tbody id="tbody_setting"><? if(is_array($settings)) foreach($settings as $value) { ?><tr>
<th><?=$value['title']?></th>
<td><?=$value['html']?></td>
</tr>
<? } if(!$is_htmlblock) { ?>
<tr>
<th>显示条数</th>
<td>
<input type="text" name="shownum" value="<?=$block['shownum']?>" class="px" />
<input type="hidden" name="parameter[bannedids]" value="<?=$block['param']['bannedids']?>" />
</td>
</tr>
<? } if(!$nocachetime) { ?>
<tr>
<th>数据缓存更新</th>
<td>
<select name="cachetime" class="ps">
<option value="600"<?=$cachetimearr['600']?>>10分钟</option>
<option value="1800"<?=$cachetimearr['1800']?>>30分钟</option>
<option value="3600"<?=$cachetimearr['3600']?>>1小时</option>
<option value="43200"<?=$cachetimearr['43200']?>>12小时</option>
<option value="86400"<?=$cachetimearr['86400']?>>1天</option>
<option value="604800"<?=$cachetimearr['604800']?>>1周</option>
<option value="2592000"<?=$cachetimearr['2592000']?>>1月</option>
<option value="0"<?=$cachetimearr['0']?>>不更新</option>
</select>
</tr>
<? } ?>
</tbody>
<? if(!$is_htmlblock) { ?>
<tr>
<th>显示样式</th>
<td>
<select name="styleid" onchange="block_show_thumbsetting('<?=$_GET['classname']?>', this.value, '<?=$block['bid']?>')" class="ps"><? if(is_array($theclass['style'])) foreach($theclass['style'] as $key => $value) { ?><option value="<?=$key?>"<?=$stylearr[$key]?>><?=$value['name']?></option>
<? } ?>
</select>
</td>
</tr>
<? } ?>
<tbody id="tbody_thumbsetting">
<? if($thestyle['makethumb']) { ?>
<tr>
<th>缩略图宽度</th>
<td><input type="text" name="picwidth" value="<?=$block['picwidth']?>" class="px" /></td>
</tr>
<tr>
<th>缩略图高度</th>
<td><input type="text" name="picheight" value="<?=$block['picheight']?>" class="px" /></td>
</tr>
<? } if($thestyle['settarget']) { ?>
<tr>
<th>链接打开方式</th>
<td>
<select name="a_target">
<option value="blank" <?=$targetarr['blank']?>>新链接打开</option>
<option value="self" <?=$targetarr['self']?>>本页面打开</option>
<option value="top" <?=$targetarr['top']?>>本页面打开（跳出框架）</option>
</select>
</td>
</tr>
<? } ?>
</tbody>
<tr>
<th>模块标识</th>
<td><input type="text" name="name" value="<?=$block['name']?>" class="px" /></td>
</tr>
</table>
</div>
</div>
<div class="o pns">
<input type="hidden" name="blocksubmit" value="true" />
<input type="hidden" name="handlekey" value="<?=$_G['gp_handlekey']?>" />
<input type="hidden" name="eleid" value="<?=$_GET['eleid']?>" />
<input type="hidden" name="formhash" value="<?=FORMHASH?>" />
<button type="submit" class="pn pnc"><strong>确定</strong></button>
</div>
</form>
<? } if($blockdataperm) { ?>
<form id="blockformdata" name="blockformdata" method="post" autocomplete="off" action="portal.php?mod=portalcp&amp;ac=block&amp;op=block&amp;classname=<?=$_GET['classname']?>&amp;bid=<?=$block['bid']?>&amp;eleid=<?=$_GET['eleid']?>&amp;tpl=<?=$_GET['tpl']?>"<? if($tab=="setting") { ?> style="display: none;"<? } ?> onsubmit="ajaxpost('blockformdata','return_<?=$_G['gp_handlekey']?>','return_<?=$_G['gp_handlekey']?>','onerror');">
  <div class="c" style="width:420px;height:<?=$height?>; _padding-right: 0; _margin-right: 17px; overflow-y: auto; ">
<div id="block_data">
<table class="dt">
<tr>
<th width="40">位置</th>
<th width="280">标题</th>
<th class="pns" width="140"><button class="pn" onclick="showWindow('showblock','portal.php?mod=portalcp&ac=block&op=item&bid=<?=$block['bid']?>');"><em>添加数据</em></button></th>
</tr><? if(is_array($itemlist)) foreach($itemlist as $item) { ?><tr>
<td><? if($item['itemtype']=='1') { ?><img src="<?=STATICURL?>image/common/locked.gif" alt="固定" title="固定数据" /><? } ?><?=$blockitem['displayorder']?></td>
<td><?=$item['title']?></td>
<!--td><?=$item['summary']?></td-->
<td>
<a href="portal.php?mod=portalcp&amp;ac=block&amp;op=item&amp;bid=<?=$block['bid']?>&amp;itemid=<?=$item['itemid']?>" onclick="showWindow('showblock', this.href);">编辑</a>
&nbsp;&nbsp;
<? if($item['itemtype']=='1') { ?>
<a href="javascript:;" onclick="block_delete_item('<?=$block['bid']?>', '<?=$item['itemid']?>', 1); return false;">删除</a>
<? } else { ?>
<a href="javascript:;" onclick="block_delete_item('<?=$block['bid']?>', '<?=$item['itemid']?>', 0); return false;">屏蔽</a>
<? } ?>
</td>
</tr>
<? } ?>
</table>
<? if($block['param']['bannedids']) { ?>
<h4><a href="javascript:;" onclick="$('p_bannedids').style.display='block';return false;">查看屏蔽数据</a></h4>
<p id="p_bannedids" style="display:none;">
<label>屏蔽数据</label>
<input type="text" name="bannedids" value="<?=$block['param']['bannedids']?>" class="px" />
</p>
<? } ?>
</div>
</div>
<div class="o pns">
<input type="hidden" name="eleid" value="<?=$_GET['eleid']?>" />
<input type="hidden" name="handlekey" value="<?=$_G['gp_handlekey']?>" />
<input type="hidden" name="updatesubmit" value="true" />
<input type="hidden" name="formhash" value="<?=FORMHASH?>" />
<button type="submit" class="pn pnc"><strong>更新</strong></button>
</div>
</form>
<? } ?>
<script type="text/javascript" reload="1">
function succeedhandle_<?=$_G['gp_handlekey']?> (url, message, values) {
<? if(empty($blocktype)) { ?>
var bid = values['bid'];
var eleid = typeof values['eleid'] == 'undefined' ? 0 : values['eleid'];
var x = new Ajax();
var openTitle = 0;
x.get('portal.php?mod=portalcp&ac=block&op=getblock&bid='+bid+'&tpl=<?=$_GET['tpl']?>&inajax=1', function(s) {
var obj = document.createElement('div');
bid = 'portal_block_'+bid;
obj.innerHTML = s;
if ($(bid) != null) {
drag.stopSlide(bid);
if($(bid+'_content')) $(bid+'_content').parentNode.removeChild($(bid+'_content'));
$(bid).innerHTML = obj.childNodes[0].innerHTML;
} else {
$(eleid).parentNode.replaceChild(obj.childNodes[0],$(eleid));
openTitle = 1;
}
drag.initPosition();
evalscript(s);
if (openTitle == 1)	drag.openTitleEdit(bid);
});
<? } else { ?>
location.reload();
<? } ?>
hideWindow('<?=$_G['gp_handlekey']?>');
}
</script>
<? } elseif($op == 'setting') { if(is_array($settings)) foreach($settings as $value) { ?><tr>
<th><?=$value['title']?></th>
<td><?=$value['html']?></td>
</tr>
<? } if(!$is_htmlblock) { ?>
<tr>
<th>显示条数</th>
<td><input type="text" name="shownum" value="<?=$block['shownum']?>" class="px" /></td>
</tr>
<tr>
<th>屏蔽数据</th>
<td><input type="text" name="parameter[bannedids]" value="<?=$block['param']['bannedids']?>" class="px" /></td>
</tr>
<? } if(!$nocachetime) { ?>
<tr>
<th>数据缓存更新</th>
<td>
<select name="cachetime">
<option value="600"<?=$cachetimearr['600']?>>10分钟</option>
<option value="1800"<?=$cachetimearr['1800']?>>30分钟</option>
<option value="3600"<?=$cachetimearr['3600']?>>1小时</option>
<option value="43200"<?=$cachetimearr['43200']?>>12小时</option>
<option value="86400"<?=$cachetimearr['86400']?>>1天</option>
<option value="604800"<?=$cachetimearr['604800']?>>1周</option>
<option value="2592000"<?=$cachetimearr['2592000']?>>1月</option>
<option value="0"<?=$cachetimearr['0']?>>不更新</option>
</select>
</tr>
<? } } elseif($op == 'item' || $op == 'push') { if($op == 'item') { ?>
<script src="<?=$_G['setting']['jspath']?>forum_calendar.js?<?=VERHASH?>" type="text/javascript"></script>
<h3 class="flb">
<em id="return_<?=$_G['gp_handlekey']?>">编辑模块</em>
<span>
<a href="portal.php?mod=portalcp&amp;ac=block&amp;op=edit&amp;bid=<?=$bid?>" onclick="showWindow('showblock', this.href);closecalendar(e);return false;"> &lt;&lt;&lt;返回 </a>
<? if($_G['inajax']) { ?><a href="javascript:;" class="flbc" onclick="hideWindow('<?=$_G['gp_handlekey']?>');<? if(empty($bid)) { ?>drag.removeBlock('<?=$_GET['eleid']?>');<? } ?>return false;" title="关闭">关闭</a><? } ?>
</span>
</h3>
<form id="blockform" name="blockform" method="post" autocomplete="off" action="portal.php?mod=portalcp&amp;ac=block&amp;op=item&amp;bid=<?=$block['bid']?>&amp;itemid=<?=$itemid?>" onsubmit="ajaxpost('blockform','return_<?=$_G['gp_handlekey']?>','return_<?=$_G['gp_handlekey']?>','onerror');" enctype="multipart/form-data">
<div class="c" style="height:<?=$height?>; width: 420px; _padding-right: 0; _margin-right: 17px; overflow-y: auto;">
<table class="tfm">
<tr>
<th>从数据源获取</th>
<td>
<select id="push_idtype" class="ps">
<option value="tids" selected="selected">帖子</option>
<option value="blogids">日志</option>
<option value="aids">文章</option>
<option value="picids">图片</option>
</select>
<input type="text" id="push_id" value=""/>
<input type="button" value="获取" onclick="block_pushitem('<?=$block['bid']?>')" class="btn" />
</td>
</tr>
<tr>
<th>显示位置</th>
<td>
<select name="displayorder" class="ps"><? if(is_array($orders)) foreach($orders as $value) { ?><option value="<?=$value?>"<?=$orderarr[$value]?>><?=$value?></option>
<? } ?>
</select>
&nbsp;&nbsp;
<? if($itemid) { ?>
<input type="checkbox" class="pc" name="locked" id="lock_item" value="1"<? if($item['itemtype']=='1') { ?>checked="checked"<? } ?> />
<label for="lock_item">固定</label>
<? } else { ?>
<input type="checkbox" class="pc" name="locked" id="lock_item" value="1" checked="checked" disabled="disabled" />
<label>固定</label>
<? } ?>
</td>
</tr>
<tr>
<th>开始时间</th>
<td><input type="text" class="px" name="startdate"<? if($item['startdate']) { ?> value="<?=$blockitem['startdate']?>"<? } ?> onclick="showcalendar(event, this, true)" /> 留空表示立即开始</td>
</tr>
<tr>
<th>失效时间</th>
<td><input type="text" class="px" name="enddate"<? if($item['enddate']) { ?> value="<?=$blockitem['enddate']?>"<? } ?> onclick="showcalendar(event, this, true)" /> 留空表示不失效</td>
</tr>
<tbody id="tbody_pushcontent">
<? } if(is_array($theclass['fields'])) foreach($theclass['fields'] as $fieldname => $field) { if($field['formtype']!='hidden') { ?>
<tr>
<th><?=$field['name']?></th>
<td>
<? if($field['formtype']=='title') { ?>
<input type="text" name="title" value="<?=$itemfields['title']?>" class="px" />
<div class="ss">
<em <?=$showstylearr['title_b']?> id="span_title_b"  onclick="block_showstyle('title_b')">B</em>
<input type="hidden" id="value_title_b" name="showstyle[title_b]" value="<?=$blockitem['showstyle']['title_b']?>" />
<em <?=$showstylearr['title_i']?> id="span_title_i"  onclick="block_showstyle('title_i')"><i>I</i></em>
<input type="hidden" id="value_title_i" name="showstyle[title_i]" value="<?=$blockitem['showstyle']['title_i']?>" />
<em <?=$showstylearr['title_u']?> id="span_title_u"  onclick="block_showstyle('title_u')">U</em>
<input type="hidden" id="value_title_u" name="showstyle[title_u]" value="<?=$blockitem['showstyle']['title_u']?>" />
<input size="6" id="title_color_value" type="text" name="showstyle[title_c]" value="<?=$blockitem['showstyle']['title_c']?>" />
<input id="ctitlepb" onclick="createPalette('titlepb', 'title_color_value');" type="button" class="colorwd" value="" style="background: <?=$blockitem['showstyle']['title_c']?>">
</div>
<? } elseif($field['formtype']=='summary') { ?>
<textarea name="summary" class="pt"><?=$itemfields['summary']?></textarea>
<div class="ss">
<em <?=$showstylearr['summary_b']?> id="span_summary_b"  onclick="block_showstyle('summary_b')">B</em>
<input type="hidden" id="value_summary_b" name="showstyle[summary_b]" value="<?=$blockitem['showstyle']['summary_b']?>" />
<em <?=$showstylearr['summary_i']?> id="span_summary_i"  onclick="block_showstyle('summary_i')"><i>I</em>
<input type="hidden" id="value_summary_i" name="showstyle[summary_i]" value="<?=$blockitem['showstyle']['summary_i']?>" />
<em <?=$showstylearr['summary_u']?> id="span_summary_u"  onclick="block_showstyle('summary_u')">U</em>
<input type="hidden" id="value_summary_u" name="showstyle[summary_u]" value="<?=$blockitem['showstyle']['summary_u']?>" />
<input size="6" id="summary_color_value" type="text" name="showstyle[summary_c]" value="<?=$blockitem['showstyle']['summary_c']?>" />
<input id="csummarypb" onclick="createPalette('summarypb', 'summary_color_value');" type="button" class="colorwd" value="" style="background: <?=$blockitem['showstyle']['summary_c']?>">
</div>
<? } elseif($field['formtype'] == 'textarea') { ?>
<textarea name="<?=$fieldname?>"><?=$itemfields[$fieldname]?></textarea>
<? } elseif($field['formtype'] == 'pic') { ?>
<input type="radio" class="pr" id="picway_remote" name="picway" onchange="showpicedit()" checked /><label for="picway_remote">远程</label> &nbsp;
<input type="radio" class="pr" id="picway_upload" name="picway" onchange="showpicedit()" /><label for="picway_upload">上传</label><br />
 <input type="text" name="pic" class="px" id="pic_remote" value="<?=$itemfields['pic']?>" />
<input type="hidden" name="picflag" value="<?=$itemfields['picflag']?>" />
<input type="file" name="pic" class="pf" id="pic_upload" style="display: none"/>
<? if($itemfields['pic']) { ?>
<br />
<a href="<?=$itemfields['pic']?>" target="_blank" title="查看原图"><img src="<?=$itemfields['pic']?>" alt="" width="80" height="60" /></a>
<? } } elseif($field['formtype'] == 'date') { ?>
<input type="text" class="px" name="<?=$fieldname?>" value="<?=$itemfields[$fieldname]?>" onclick="showcalendar(event, this, true)" />
<? } else { ?>
<input type="text" class="px" name="<?=$fieldname?>" value="<?=$itemfields[$fieldname]?>" />
<? } ?>
</td>
</tr>
<? } } if($op == 'item') { ?>
</tbody>		
</table>
</div>
<div class="o pns">
<input type="hidden" name="itemsubmit" value="true" />
<input type="hidden" name="handlekey" value="<?=$_G['gp_handlekey']?>" />
<input type="hidden" name="formhash" value="<?=FORMHASH?>" />
<button type="submit" class="pn pnc"><strong>提交</strong></button>
</div>
</form>
<script type="text/javascript" reload="1">
if (typeof ctitlepb_frame == 'object' && !BROWSER.ie) {delete ctitlepb_frame;}
if (typeof csummarypb_frame == 'object' && !BROWSER.ie) {delete csummarypb_frame;}
function succeedhandle_<?=$_G['gp_handlekey']?> (url, message, values) {
showWindow('<?=$_G['gp_handlekey']?>', 'portal.php?mod=portalcp&ac=block&op=block&tab=data&&bid='+values['bid'], 'get' ,0);
}
</script>
<? } } elseif($op == 'thumbsetting') { if($thestyle['makethumb']) { ?>
<tr>
<th>缩略图宽度</th>
<td><input type="text" name="picwidth" value="<?=$block['picwidth']?>" class="px" /></td>
</tr>
<tr>
<th>缩略图高度</th>
<td><input type="text" name="picheight" value="<?=$block['picheight']?>" class="px" /></td>
</tr>
<? } if($thestyle['settarget']) { ?>
<tr>
<th>链接打开方式</th>
<td>
<select name="a_target">
<option value="blank" <?=$targetarr['blank']?>>新链接打开</option>
<option value="self" <?=$targetarr['self']?>>本页面打开</option>
<option value="top" <?=$targetarr['top']?>>本页面打开（跳出框架）</option>
</select>
</td>
</tr>
<? } } elseif($op == 'getblock') { if(!$_G['inajax']) { ?>
<div class="wp"><div class="area"><div class="frame move-span frame-1 cl">
<? } ?>
<?=$html?>
<? if(!$_G['inajax']) { ?>
</div></div></div>
<? } } include template('common/footer'); ?>